package com.hemerasolutions.v2trainer.model.training.statistic;

import javax.persistence.Column;
import javax.persistence.Entity;
import com.hemerasolutions.v2trainer.model.base.BaseModel;

@Entity
public class StatisticUnit extends BaseModel {

	private static final long serialVersionUID = 1L;

    @Column(length = 40)
	private String name;
	 
    @Column(length = 40)
    private String description;

    @Column(unique=true)
    private int unitType = SU_TYPE_A;
	
    public static final int SU_TYPE_A 	= 1;
    public static final int SU_TYPE_B 	= 2;
    public static final int SU_TYPE_C 	= 3;
    public static final int SU_TYPE_D 	= 4;
    public static final int SU_TYPE_E 	= 5;
    public static final int SU_TYPE_F 	= 6;

    
    
    
    public StatisticUnit() {
		super();
    }

	public StatisticUnit(int unitType, String name, String description) {
    	this();
    	this.name = name;
		this.description = description;
		this.unitType = unitType;
	}

    public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	
	public int getUnitType() {
		return unitType;
	}

	public void setUnitType(int unitType) {
		this.unitType = unitType;
	}


	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		StatisticUnit other = (StatisticUnit) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}
	@Override
	public String toString() {
		return "StatisticUnit [id=" + id + ", name=" + name + "]";
	}

	
	
}
